//通过reudx中的值,渲染页面
import store from "./Store"
import { useState, useEffect } from "react"
const Other = props => {
    let [chatInfo, setChatInfo] = useState(store.getState());

    useEffect(function () {
        store.subscribe(function () {
            setChatInfo(store.getState())
        })
    }, [])

    let { chatLog = [] } = chatInfo

    return (
        <fieldset>
            <legend>其它组件</legend>
            <ul>
                {
                    chatLog.map((item, i) => {
                        return (
                            <li key={i}>{item}</li>
                        )
                    })
                }
            </ul>
        </fieldset>
    )
}

export default Other